<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/templates/template_admin.xhtml">
        <ui:define name="content">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <h1><h:outputText value="Create Applicant"/></h1>
                <h:panelGrid columns="2">
                    <h:outputLabel value="ApplicantID" for="applicantID" />
                    <p:inputText id="applicantID" value="#{hrmb.app.applicantID}" required="true" requiredMessage="You must enter id">                
                    </p:inputText>
                    <h:outputLabel value="FirstName" for="firstName" />
                    <p:inputText id="firstName" value="#{hrmb.app.firstName}"  required="true" requiredMessage="You must enter firstname">                   
                    </p:inputText>
                    <h:outputLabel value="LastName" for="lastName" />
                    <p:inputText id="lastName" value="#{hrmb.app.lastName}"  required="true" requiredMessage="You must enter lastname">
                    </p:inputText>
                    <h:outputLabel value="Gender" for="gender" />
                    <h:selectOneMenu id="gender"
                                     value="#{hrmb.app.gender}"
                                     styleClass="text-input medium-input">
                        <f:selectItem itemLabel="Male" itemValue="#{true}"/>
                        <f:selectItem itemLabel="Female" itemValue="#{false}" />
                    </h:selectOneMenu>
                    <h:outputLabel value="dob" for="dob" />
                    <p:calendar value="#{hrmb.app.dob}"
                                id="dob"
                                navigator="true"
                                yearRange="c-50:c+50"
                                mindate="1/1/62"
                                maxdate="#{calendarMB.currentDate}"
                                pattern="yyyy-MM-dd"
                                styleClass="remove"
                                required="true"
                                requiredMessage="You must enter date of birth."
                                validator="#{vlmb.validateDOB}">
                    </p:calendar>

                    <h:outputLabel value="PhoneNumber" for="phoneNumber" />
                    <p:inputText id="phoneNumber" value="#{hrmb.app.phoneNumber}" required="true" validator="#{vlmb.validatePhoneNumber}"/>
                    <h:outputLabel value="Email" for="email" />
                    <p:inputText value="#{hrmb.app.email}"
                                 styleClass="text-input medium-input"
                                 id="email"
                                 required="true"
                                 requiredMessage="You must enter email address."
                                 validator="#{vlmb.validate}"/>

                    <h:outputLabel value="Address" for="address" />
                    <h:inputTextarea id="address" value="#{hrmb.app.address}" style="width: 300px" required="true" requiredMessage="You must enter address" />

                    <h:outputLabel value="SalaryRequirement" for="salaryRequirement" />
                    <p:inputText value="#{hrmb.app.salaryRequirement}"
                                 styleClass="text-input medium-input" id="salary"
                                 converterMessage="Salary Input is wrong format"
                                 validator="#{vlmb.validateSalary}"/>     
                    <h:outputLabel value="Language" for="language" />
                    <h:inputTextarea id="language" value="#{hrmb.app.language}" style="width: 300px" required="true" requiredMessage="You must enter language" />

                    <h:outputLabel value="YearOfExperience" for="yearOfExperience" />
                    <p:inputText value="#{hrmb.app.yearOfExperience}"
                                 styleClass="text-input medium-input" id="year"
                                 />     
                    <h:outputLabel value="Degree" for="degree" />
                    <h:inputTextarea id="degree" value="#{hrmb.app.degree}" style="width: 300px" required="true" requiredMessage="You must enter degree">

                    </h:inputTextarea>

                    <h:outputLabel value="Skill" for="skill" />
                    <h:inputTextarea id="skill" value="#{hrmb.app.skill}" style="width: 300px" required="true" requiredMessage="You must enter skill"/>

                    <h:outputLabel value="Award" for="award" />
                    <h:inputTextarea id="award" value="#{hrmb.app.award}" style="width: 300px" required="true" requiredMessage="You must enter award"/>

                </h:panelGrid>
                <br />
                <h:commandButton action="#{hrmb.addapplicant()}" value="Save" />                
                <br/>
                <h:commandButton action="ListApplicant" value="List"/>
                <br />           
            </h:form>
        </ui:define>
    </ui:composition>

</html>
